import {Entity,Column,PrimaryGeneratedColumn,CreateDateColumn, OneToMany, OneToOne, JoinColumn} from "typeorm"
import {Staff} from "./my.entity"

@Entity()

export class  Identity{
    @PrimaryGeneratedColumn({type:"int"})
    identityId:number

    @Column({type:"varchar"})
    staff_id:string

    @Column({type:"varchar",length:100})
    salary:string
    
    @Column({type:"varchar",length:50,default:0})
    power:string
    @Column({type:"varchar",length:100})
    employeeNo:string
    @CreateDateColumn({type:"timestamp"})
    idenCreateTime:Date
    @Column({type:"varchar",length:50,default:0})
    teamId:string
    @Column({type:"varchar",length:50,default:1})
    job:string
    @Column({type:"varchar",length:50,default:123123,select:false})
    password:string
    
    @OneToOne(()=>Staff,(staff)=>staff.identity,{eager:true,cascade:true})
    @JoinColumn({name:"staff_id",referencedColumnName:"staffId"})
    staff:Staff
}